﻿using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Hosting;
using Configuration.ServerApi.Param;
using Configuration.ServerApi.Service;
using System.Threading.Tasks;

namespace Configuration.ServerApi.Controllers
{
    /// <summary>
    /// 记录相关Controller
    /// </summary>
    [Authorize("AuthJwt")]
    [Route("api/[controller]")]
    [ApiController]
    public class RecordController : ControllerBase
    {
        private readonly IHostEnvironment HostEnvironment;
        private readonly IRecordService RecordService;

        #region 构造函数

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="hostEnvironment"></param>
        /// <param name="recordService"></param>
        public RecordController(IHostEnvironment hostEnvironment,
            IRecordService recordService)
        {
            HostEnvironment = hostEnvironment;
            RecordService = recordService;
        }

        #endregion

        #region 获取操作记录列表

        /// <summary>
        /// 获取操作记录列表
        /// </summary>
        /// <param name="param">搜索条件</param>
        /// <returns>JSON结果集</returns>
        [HttpPost]
        [Route("OperationRecordList")]
        public async Task<IActionResult> OperationRecordList(SearchModel param)
        {
            return await RecordService.OperationRecordList(param);
        }

        #endregion

        #region 获取操作记录详情

        /// <summary>
        /// 获取操作记录详情
        /// </summary>
        /// <param name="param">搜索条件</param>
        /// <returns>JSON结果集</returns>
        [HttpPost]
        [Route("OperationRecordDetail")]
        public async Task<IActionResult> OperationRecordDetail(SearchModel param)
        {
            return await RecordService.OperationRecordDetail(param);
        }

        #endregion

        #region 提交操作记录信息

        /// <summary>
        /// 提交操作记录信息
        /// </summary>
        /// <param name="param">更新参数集</param>
        /// <returns>JSON结果集</returns>
        [HttpPost]
        [Route("SubmitOperationRecord")]
        public async Task<IActionResult> SubmitOperationRecord(UpdateModel param)
        {
            return await RecordService.SubmitOperationRecord(param);
        }

        #endregion

        #region 批量删除操作记录信息

        /// <summary>
        /// 批量删除操作记录信息
        /// </summary>
        /// <param name="param">更新参数集</param>
        /// <returns>JSON结果集</returns>
        [HttpPost]
        [Route("DelOperationRecord")]
        public async Task<IActionResult> DelOperationRecord(UpdateModel param)
        {
            return await RecordService.DelOperationRecord(param);
        }

        #endregion

        #region 获取实验任务队列数据

        /// <summary>
        /// 获取实验任务队列数据
        /// </summary>
        /// <param name="param">搜索条件</param>
        /// <returns>JSON结果集</returns>
        [HttpPost]
        [Route("ExperimentTaskQueueList")]
        public async Task<IActionResult> ExperimentTaskQueueList(SearchModel param)
        {
            return await RecordService.ExperimentTaskQueueList(param);
        }

        #endregion

        #region 获取实验记录列表

        /// <summary>
        /// 获取实验记录列表
        /// </summary>
        /// <param name="param">搜索条件</param>
        /// <returns>JSON结果集</returns>
        [HttpPost]
        [Route("ExperimentRecordList")]
        public async Task<IActionResult> ExperimentRecordList(SearchModel param)
        {
            return await RecordService.ExperimentRecordList(param);
        }

        #endregion

        #region 获取球磨机1实验运行日志列表

        /// <summary>
        /// 获取球磨机1实验运行日志列表
        /// </summary>
        /// <param name="param">搜索条件</param>
        /// <returns>JSON结果集</returns>
        [HttpPost]
        [Route("ExperimentRunLogByBallMillingList")]
        public async Task<IActionResult> ExperimentRunLogByBallMillingList(SearchModel param)
        {
            return await RecordService.ExperimentRunLogByBallMillingList(param);
        }

        #endregion

        #region 获取球磨机2实验运行日志列表

        /// <summary>
        /// 获取球磨机2实验运行日志列表
        /// </summary>
        /// <param name="param">搜索条件</param>
        /// <returns>JSON结果集</returns>
        [HttpPost]
        [Route("ExperimentRunLogByBallMillingTwoList")]
        public async Task<IActionResult> ExperimentRunLogByBallMillingTwoList(SearchModel param)
        {
            return await RecordService.ExperimentRunLogByBallMillingTwoList(param);
        }

        #endregion

        #region 获取管式炉实验运行日志列表

        /// <summary>
        /// 获取管式炉实验运行日志列表
        /// </summary>
        /// <param name="param">搜索条件</param>
        /// <returns>JSON结果集</returns>
        [HttpPost]
        [Route("ExperimentRunLogByTubeFurnaceList")]
        public async Task<IActionResult> ExperimentRunLogByTubeFurnaceList(SearchModel param)
        {
            return await RecordService.ExperimentRunLogByTubeFurnaceList(param);
        }

        #endregion

        #region 获取下装炉实验运行日志列表

        /// <summary>
        /// 获取下装炉实验运行日志列表
        /// </summary>
        /// <param name="param">搜索条件</param>
        /// <returns>JSON结果集</returns>
        [HttpPost]
        [Route("ExperimentRunLogByBottomFurnaceList")]
        public async Task<IActionResult> ExperimentRunLogByBottomFurnaceList(SearchModel param)
        {
            return await RecordService.ExperimentRunLogByBottomFurnaceList(param);
        }

        #endregion

        #region 获取自动化烘干机实验运行日志列表

        /// <summary>
        /// 获取自动化烘干机实验运行日志列表
        /// </summary>
        /// <param name="param">搜索条件</param>
        /// <returns>JSON结果集</returns>
        [HttpPost]
        [Route("ExperimentRunLogByOvenList")]
        public async Task<IActionResult> ExperimentRunLogByOvenList(SearchModel param)
        {
            return await RecordService.ExperimentRunLogByOvenList(param);
        }

        #endregion

        #region 获取电化学测试仪器实验运行日志列表

        /// <summary>
        /// 获取电化学测试仪器实验运行日志列表
        /// </summary>
        /// <param name="param">搜索条件</param>
        /// <returns>JSON结果集</returns>
        [HttpPost]
        [Route("ExperimentRunLogByElectroChemistryTestList")]
        public async Task<IActionResult> ExperimentRunLogByElectroChemistryTestList(SearchModel param)
        {
            return await RecordService.ExperimentRunLogByElectroChemistryTestList(param);
        }

        #endregion

        #region 获取球磨机1图表数据

        /// <summary>
        /// 获取球磨机1图表数据
        /// </summary>
        /// <param name="param">搜索条件</param>
        /// <returns>JSON结果集</returns>
        [HttpPost]
        [Route("EChartDataByBallMilling")]
        public async Task<IActionResult> EChartDataByBallMilling(SearchModel param)
        {
            return await RecordService.EChartDataByBallMilling(param);
        }

        #endregion

        #region 获取球磨机2图表数据

        /// <summary>
        /// 获取球磨机2图表数据
        /// </summary>
        /// <param name="param">搜索条件</param>
        /// <returns>JSON结果集</returns>
        [HttpPost]
        [Route("EChartDataByBallMillingTwo")]
        public async Task<IActionResult> EChartDataByBallMillingTwo(SearchModel param)
        {
            return await RecordService.EChartDataByBallMillingTwo(param);
        }

        #endregion

        #region 获取管式炉图表数据

        /// <summary>
        /// 获取管式炉图表数据
        /// </summary>
        /// <param name="param">搜索条件</param>
        /// <returns>JSON结果集</returns>
        [HttpPost]
        [Route("EChartDataByTubeFurnace")]
        public async Task<IActionResult> EChartDataByTubeFurnace(SearchModel param)
        {
            return await RecordService.EChartDataByTubeFurnace(param);
        }

        #endregion

        #region 获取下装炉图表数据

        /// <summary>
        /// 获取下装炉图表数据
        /// </summary>
        /// <param name="param">搜索条件</param>
        /// <returns>JSON结果集</returns>
        [HttpPost]
        [Route("EChartDataByBottomFurnace")]
        public async Task<IActionResult> EChartDataByBottomFurnace(SearchModel param)
        {
            return await RecordService.EChartDataByBottomFurnace(param);
        }

        #endregion

        #region 获取自动化烘干机图表数据

        /// <summary>
        /// 获取自动化烘干机图表数据
        /// </summary>
        /// <param name="param">搜索条件</param>
        /// <returns>JSON结果集</returns>
        [HttpPost]
        [Route("EChartDataByOven")]
        public async Task<IActionResult> EChartDataByOven(SearchModel param)
        {
            return await RecordService.EChartDataByOven(param);
        }

        #endregion

        #region 获取实验记录详情

        /// <summary>
        /// 获取实验记录详情
        /// </summary>
        /// <param name="param">搜索条件</param>
        /// <returns>JSON结果集</returns>
        [HttpPost]
        [Route("ExperimentRecordDetail")]
        public async Task<IActionResult> ExperimentRecordDetail(SearchModel param)
        {
            return await RecordService.ExperimentRecordDetail(param);
        }

        #endregion

        #region 提交实验记录信息

        /// <summary>
        /// 提交实验记录信息
        /// </summary>
        /// <param name="param">更新参数集</param>
        /// <returns>JSON结果集</returns>
        [HttpPost]
        [Route("SubmitExperimentRecord")]
        public async Task<IActionResult> SubmitExperimentRecord(UpdateModel param)
        {
            return await RecordService.SubmitExperimentRecord(param);
        }

        #endregion

        #region 批量删除实验记录信息

        /// <summary>
        /// 批量删除实验记录信息
        /// </summary>
        /// <param name="param">更新参数集</param>
        /// <returns>JSON结果集</returns>
        [HttpPost]
        [Route("DelExperimentRecord")]
        public async Task<IActionResult> DelExperimentRecord(UpdateModel param)
        {
            return await RecordService.DelExperimentRecord(param);
        }

        #endregion

        #region 更新实验记录状态

        /// <summary>
        /// 更新实验记录状态
        /// </summary>
        /// <param name="param">更新参数集</param>
        /// <returns>JSON结果集</returns>
        [HttpPost]
        [Route("UpdateExperimentRecordStstus")]
        public async Task<IActionResult> UpdateExperimentRecordStstus(UpdateModel param)
        {
            return await RecordService.UpdateExperimentRecordStstus(param);
        }

        #endregion

        #region 更新实验任务顺序

        /// <summary>
        /// 更新实验任务顺序
        /// </summary>
        /// <param name="param">更新参数集</param>
        /// <returns>JSON结果集</returns>
        [HttpPost]
        [Route("UpdateExperimentRecordSort")]
        public async Task<IActionResult> UpdateExperimentRecordSort(UpdateModel param)
        {
            return await RecordService.UpdateExperimentRecordSort(param);
        }

        #endregion

        #region 获取实验运行日志列表

        /// <summary>
        /// 获取实验运行日志列表
        /// </summary>
        /// <param name="param">搜索条件</param>
        /// <returns>JSON结果集</returns>
        [HttpPost]
        [Route("ExperimentRunLogList")]
        public async Task<IActionResult> ExperimentRunLogList(SearchModel param)
        {
            return await RecordService.ExperimentRunLogList(param);
        }

        #endregion

        #region 获取实验运行日志详情

        /// <summary>
        /// 获取实验运行日志详情
        /// </summary>
        /// <param name="param">搜索条件</param>
        /// <returns>JSON结果集</returns>
        [HttpPost]
        [Route("ExperimentRunLogDetail")]
        public async Task<IActionResult> ExperimentRunLogDetail(SearchModel param)
        {
            return await RecordService.ExperimentRunLogDetail(param);
        }

        #endregion

        #region 提交实验运行日志信息

        /// <summary>
        /// 提交实验运行日志信息
        /// </summary>
        /// <param name="param">更新参数集</param>
        /// <returns>JSON结果集</returns>
        [HttpPost]
        [Route("SubmitExperimentRunLog")]
        public async Task<IActionResult> SubmitExperimentRunLog(UpdateModel param)
        {
            return await RecordService.SubmitExperimentRunLog(param);
        }

        #endregion

        #region 批量删除实验运行日志信息

        /// <summary>
        /// 批量删除实验运行日志信息
        /// </summary>
        /// <param name="param">更新参数集</param>
        /// <returns>JSON结果集</returns>
        [HttpPost]
        [Route("DelExperimentRunLog")]
        public async Task<IActionResult> DelExperimentRunLog(UpdateModel param)
        {
            return await RecordService.DelExperimentRunLog(param);
        }

        #endregion

        #region 获取预警记录列表

        /// <summary>
        /// 获取预警记录列表
        /// </summary>
        /// <param name="param">搜索条件</param>
        /// <returns>JSON结果集</returns>
        [HttpPost]
        [Route("WarningRecordList")]
        public async Task<IActionResult> WarningRecordList(SearchModel param)
        {
            return await RecordService.WarningRecordList(param);
        }

        #endregion

        #region 获取预警记录详情

        /// <summary>
        /// 获取预警记录详情
        /// </summary>
        /// <param name="param">搜索条件</param>
        /// <returns>JSON结果集</returns>
        [HttpPost]
        [Route("WarningRecordDetail")]
        public async Task<IActionResult> WarningRecordDetail(SearchModel param)
        {
            return await RecordService.WarningRecordDetail(param);
        }

        #endregion

        #region 提交预警记录信息

        /// <summary>
        /// 提交预警记录信息
        /// </summary>
        /// <param name="param">更新参数集</param>
        /// <returns>JSON结果集</returns>
        [HttpPost]
        [Route("SubmitWarningRecord")]
        public async Task<IActionResult> SubmitWarningRecord(UpdateModel param)
        {
            return await RecordService.SubmitWarningRecord(param);
        }

        #endregion

        #region 批量删除预警记录信息

        /// <summary>
        /// 批量删除预警记录信息
        /// </summary>
        /// <param name="param">更新参数集</param>
        /// <returns>JSON结果集</returns>
        [HttpPost]
        [Route("DelWarningRecord")]
        public async Task<IActionResult> DelWarningRecord(UpdateModel param)
        {
            return await RecordService.DelWarningRecord(param);
        }

        #endregion

    }
}
